package com.base.pojo;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * this is a class demo.
 *
 * @author pretty_boy
 * @date 2018/9/26 14:47
 */
public class Numbers {
    public static void main(String[] args) {
        Integer x = 5;
        x = x + 5;
        System.out.println(x);

        Date date = new Date();
        System.out.println("字符串显示日期：" + date.toString());
        //字符串显示日期：Wed Sep 26 18:52:32 CST 2018
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //当前时间是：2018-09-26 18:52:32,如果hh:mm:ss   此时表示的12小时制

        System.out.println("当前时间是：" + format.format(date));

        Calendar calendar = Calendar.getInstance();
        //Calendar 类，只能通过其静态方法来获得实例对象
        calendar.set(2018,9,26);
        //Calendar类，可以单独获得年、月、日
        System.out.println(calendar.get(Calendar.YEAR) + "年" + calendar.get(Calendar.MONTH )+ "月" + calendar.get(Calendar.DAY_OF_MONTH) + "日");
    }
}
